# -*- coding: utf-8 -*-

import os
import random
from tkinter import *           # 导入 Tkinter 库

import pandas as pd

import sh

def say(s):
    text.insert(CURRENT, '%s\n' % s)
    sh.say(s)


df = pd.read_excel('/Users/william/Teaching/student lists/programming.xls', sheet_name='xinji17', skiprows=1)
girls = list(df[df['性别']=='女']['姓名'])

root = Tk()                     # 创建窗口对象的背景色
                                # 创建两个列表
text = Text(root)               #  创建两个列表组件
text.pack()
say('这里是非诚勿扰的录制现场, 有请信计17级%d位年轻漂亮的女嘉宾上场.' % len(girls))

k = 0
def _next():  # 回调函数
    global k, girls
    k += 1
    name = random.choice(girls)
    say('请第%d个女嘉宾出场, 大家好, 我是%s'%(k, name))


def _select():  # 回调函数
    global girls
    name = random.choice(girls)
    say('我的心动女生是%s!'%name)


button = Button(root, text="下一位", command=_next)              #  创建两个列表组件
button.pack()
button1 = Button(root, text="心动女生", command=_select)              #  创建两个列表组件
button1.pack()

# import pyglet

# music = pyglet.media.load('/Users/william/Teaching/python teaching/codes/Gee.mp3')
# music.play()

# pyglet.app.run()

root.mainloop()
